<template>
	<view>
		<!-- 头部 -->
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText" @click='backChat'>返回</block>
			<block slot="content">会话详情</block>
		</cu-custom>
        <view class='back' @click="back"></view>
		<!-- 头像 -->
		<view class="cu-list menu sm-bordercard-menu margin-top">
			<view class="padding-sm radius shadow bg-white" v-for="(item,index) in list" :key='index'>
				<view class="cu-avatar lg round margin-left fl">
                    <img :src="item.avatarurl != ''?a_url + item.avatarurl:avatar" alt="" style="width:50px;height:50px">
                </view>
				<view class='imgText fl'>{{item.name}}({{item.member_id}})</view>
				<view style="clear: both;"></view>
			</view>
			<view class="cu-item arrow">
				<view class="content">
					<text class="text-grey">查找聊天记录</text>
				</view>
			</view>
			<view class="cu-item">
				<view class="content">
					<text class="text-grey">设为置顶</text>
					<switch style="float: right;" @change="onChange"></switch>
				</view>
			</view>
		</view>
		<newMessage ref='newMessage'></newMessage>
	</view>
</template>

<script>
	import newMessage from '../../asstess/newMessage/newMessage'
	export default {
		data() {
			return {
				list:[],
                a_url:'http://v3-a.xgwl.net.cn',
                avatar:'https://ossweb-img.qq.com/images/lol/web201310/skin/big10006.jpg',
			}
		},
		components: {
			newMessage
		},
		onLoad() {
            // 获取本地存储内数据
		    let data  = sessionStorage.getItem('userData')
            this.userData = JSON.parse(data)
            // //用户信息
            this.$Socket.action('getTalkDetail',{talk_id:this.$route.query.id},(res)=>{
                if(res.code ==200){
                    this.list = res.data
                    this.$store.commit('setGetTalkDetail',res.data)
                }
            },()=>{})
            if(this.$store.state.getTalkDetail){
                this.list = this.$store.state.getTalkDetail
            }
            // 新消息弹框
        },
		methods: {
            back() {
                    uni.redirectTo({
                        url: "../talk/chat"
                    });
                },
			onChange(e){
				console.log(e)
			}
		}
	}
</script>

<style scoped>
    .back{
        background-color: transparent;
        width: 62px;
        height: 45px;
        position: fixed;
        top: 0px;
        z-index: 9999;
    }
    .bye{
        position: fixed;
        top:100px
    }
	.imgTop {
		margin-top: 10rpx;
		width: 50rpx;
		height: 50rpx;
	}
	.cu-item {
		margin-top: 10rpx;
	}
	.imgText{
		margin-top: 30rpx;
		margin-left: 10rpx;
	}
</style>
